<?php
class XA_Table_Field_Date extends XA_Table_Field {

	public $time;
	public $format;


	public function __construct($name, $label, $time = false) {
		parent::__construct($name, $label);
		$this->time = $time;
	}


	public function out($row) {
		if ($this->format) {
			return '<td class="'.implode(' ', $this->class_list).'">'.date($this->format, strtotime($row[$this->name])).'</td>';
		} else {
			return '<td class="'.implode(' ', $this->class_list).'">'.XA_Date::get($row[$this->name], $this->time).'</td>';
		}
	}
}
